package com.pth.admin.action;

import com.opensymphony.xwork2.ActionSupport;
import com.pth.model.Policy;
import com.pth.service.PolicyService;
import com.pth.utils.timeUtil;

public class AddPolicyAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Policy policy;

	private PolicyService policyService;

	public Policy getPolicy() {
		return policy;
	}

	public PolicyService getPolicyService() {
		return policyService;
	}

	public void setPolicy(Policy policy) {
		this.policy = policy;
	}
	
	public void setPolicyService(PolicyService policyService) {
		this.policyService = policyService;
	}
	
	@Override
	public String execute() throws Exception {

		policy.setPublishtime(timeUtil.getCurrentDate());
		
		policy.setScanNum(0);
		
		policyService.add(policy);
		
		return SUCCESS;
		
	}
	
	
}
